function SetFocus() {
  if (document.forms.length > 0) {
    var field = document.forms[0];
    for (i=0; i<field.length; i++) {
      if ( (field.elements[i].type != "image") &&
           (field.elements[i].type != "hidden") &&
           (field.elements[i].type != "reset") &&
           (field.elements[i].type != "submit") ) {

        document.forms[0].elements[i].focus();

        if ( (field.elements[i].type == "text") ||
             (field.elements[i].type == "password") )
          document.forms[0].elements[i].select();

        break;
      }
    }
  }
}

function rowOverEffect(object) {
  if (object.className == 'dataTableRow') object.className = 'dataTableRowOver';
}

function rowOutEffect(object) {
  if (object.className == 'dataTableRowOver') object.className = 'dataTableRow';
}

//Dom drag
function getObject( obj ) {

  // step 1
  if ( document.getElementById ) {
    obj = document.getElementById( obj );
  // step 2
  } else if ( document.all ) {
    obj = document.all.item( obj );
  //step 3
  } else {
    obj = null;
  }
  //step 4
  return obj;
  }
  
  
  function moveObject( obj, e ) {

  // step 1
  var tempX = 0;
  var tempY = 0;
  var offset = 5;
  var objHolder = obj;
  // step 2
  obj = getObject( obj );
  if (obj==null) return;
  // step 3
  if (document.all) {
    tempX = event.clientX + document.body.scrollLeft;
    tempY = event.clientY + document.body.scrollTop;
  } else {
    tempX = e.pageX;
    tempY = e.pageY;
  }
  // step 4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}
  // step 5
  obj.style.top  = (tempY + offset- 0) + 'px';
  obj.style.left = (tempX + offset - 0) + 'px';
  // step 6
  displayObject( objHolder, true );
  }
  
  function displayObject( obj, show ) {
  // step 1
  obj = getObject( obj );
  if (obj==null) return;
  // step 2
  obj.style.display = show ? 'block' : 'none';
  obj.style.visibility = show ? 'visible' : 'hidden';
  }

//musedcall
function musedcall(url, areaID) {
	var http_request = false;
	if (window.XMLHttpRequest) { 
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/html');
		}
	} else if (window.ActiveXObject) {
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
		try {
			http_request = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {}
		}
	}
	if (!http_request) {
		alert('Giving up :( Cannot create an XMLHTTP instance');
		return false;
	}
	http_request.onreadystatechange = function() { 
		if (http_request.readyState == 4) {
			if (http_request.status == 200) {
				document.getElementById(areaID).innerHTML = http_request.responseText
			} else {
				alert('There was a problem with the request.');
			}
		} else if (http_request.readyState == 1) {
			document.getElementById(areaID).innerHTML = "<div align='center' style='padding:10px 0px 10px 0px'><img src='images/loading.gif'></div"
		}
	};
	//flush ie cache problem
	if (url.indexOf("?")!=-1){
		url = url+"&ie=" + new Date().getTime();
	}else{
		url = url+"?ie=" + new Date().getTime();
	}
	http_request.open('GET', url, true);
	http_request.send(null);
}

